package com.example.meeting.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface GetMeetByIdMapper {
    //获取用户参与的所有会议id
    @Select("SELECT m_id FROM meeting_person WHERE p_id=#{user_id}")
    Integer[] getMeetById(Integer user_id);

    //插入用户会议
    @Insert("INSERT INTO meeting_person(p_id,m_id) VALUES(#{user_id},#{meeting_id})")
    void linkUserMeet(Integer user_id, Integer meeting_id);

    //根据会议id删除表中会议id为会议id的数据
    @Delete("DELETE FROM meeting_person WHERE m_id=#{meeting_id}")
    void deleteMeetById(Integer meeting_id);
}
